﻿#define _CRT_SECURE_NO_WARNINGS 1

//编程初学者入门训练第五十二题
//BC54 获得月份天数
//https://www.nowcoder.com/practice/13aeae34f8ed4697960f7cfc80f9f7f6?tpId=107&tqId=33335&rp=1&ru=/exam/oj/ta&qru=/exam/oj/ta&sourceUrl=%2Fexam%2Foj%2Fta%3FtpId%3D107&difficulty=undefined&judgeStatus=undefined&tags=&title=

#include <stdio.h>
int get_month_of_day(int y, int m) {
    //将每个月份的天数记录在数组中
    int days[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
    //获取月份的天数
    int day = days[m];
    //特判二月天数是29天的情况
    if ((y % 4 == 0 && y % 100 != 0) || (y % 400 == 0)) {
        if (m == 2)
            day += 1;
    }
    return day;
}

int main() {
    int y = 0;
    int m = 0;
    //输入
    while (scanf("%d %d", &y, &m) != EOF) {
        //获取y年m月的天数
        int ret = get_month_of_day(y, m);
        printf("%d\n", ret);
    }
    
    return 0;
}